import Vue from 'vue';
import VueRouter from 'vue-router';
import Home from '../components/Home.vue';
import List from '../components/List.vue';
import Add from '../components/Add.vue';
import Collect from '../components/Collect.vue'
import Detail from '../components/Detail.vue';
Vue.use(VueRouter);

let router =  new VueRouter({
  routes:[
    {path:'/',redirect:'/home'},//主页
    {path:'/home',component:Home},
    {path:'/list',component:List},//列表
    {path:'/collect',component:Collect},//收藏
    {path:'/add',component:Add},//个人
    {path:'/detail/:bid',component:Detail,name:'detail'},//详情
    {path:'/*',redirect:'/home'}
  ]
})
router.beforeEach(function(to,from,next){
  // to.params.bid=1;
  // console.log(to,from,next);
  next();
})
export default router;
